﻿Public Class clsTacGia
    Public Shared Function Them(ByVal MaTG As String, ByVal TenTG As String, ByVal DonViCongTac As String, ByVal DiaChi As String, ByVal DienThoai As String) As Boolean
        Return db.Query("Insert into TacGia values ('" & MaTG & "',N'" & TenTG & "',N'" & DonViCongTac & "',N'" & DiaChi & "','" & DienThoai & "')")
    End Function
    Public Shared Function DSTacGia() As DataTable
        Return db.QueryTable("Select * from TacGia")
    End Function
    Public Shared Function Xoa(ByVal MaTG As String) As Boolean
        Return db.Query("delete from TacGia where MaTG ='" & MaTG & "'")
    End Function
    Public Shared Function Sua(ByVal MaTG As String, ByVal TenTG As String, ByVal DonViCongTac As String, ByVal DiaChi As String, ByVal DienThoai As String) As Boolean
        Return db.Query("update TacGia set TenTG =N'" + TenTG + "',DonViCongTac=N'" + DonViCongTac + "',DiaChi=N'" + DiaChi + "',DienThoai=N'" + DienThoai + "' where MaTG ='" + MaTG + "'")
    End Function
    Public Shared Function TimKiem(ByVal tukhoa As String) As DataTable
        Return db.QueryTable("select * from TacGia where MaTG like '%" & tukhoa & "%' or TenTG like N'%" & tukhoa & "%'or DonViCongTac like N'%" & tukhoa & "%'or DiaChi like N'%" & tukhoa & "%'or DienThoai like '%" & tukhoa & "%'")
    End Function

End Class
